﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class RequisitionDetailOneW
    {
        int reqDetailOneID;
        int reqID;
        string itemCode;
        int requestQty;
        string reason;
        string outstandingStatus;
        string approvalStatus;

        [DataMember]
        public int ReqDetailOneID
        {
            get { return reqDetailOneID; }
            set { reqDetailOneID = value; }
        }

        [DataMember]
        public int ReqID
        {
            get { return reqID; }
            set { reqID = value; }
        }

        [DataMember]
        public string ItemCode
        {
            get { return itemCode; }
            set { itemCode = value; }
        }

        [DataMember]
        public int RequestQty
        {
            get { return requestQty; }
            set { requestQty = value; }
        }

        [DataMember]
        public string Reason
        {
            get { return reason; }
            set { reason = value; }
        }

        [DataMember]
        public string OutstandingStatus
        {
            get { return outstandingStatus; }
            set { outstandingStatus = value; }
        }

        [DataMember]
        public string ApprovalStatus
        {
            get { return approvalStatus; }
            set { approvalStatus = value; }
        }

        public static RequisitionDetailOneW convert(RequisitionDetailOne requisitionDetailOne)
        {
            RequisitionDetailOneW u = new RequisitionDetailOneW();

            u.ReqDetailOneID = requisitionDetailOne.ReqDetailOneID;
            u.ReqID = requisitionDetailOne.ReqID.GetValueOrDefault();
            u.ItemCode = requisitionDetailOne.ItemCode;
            u.RequestQty = requisitionDetailOne.RequestQty.GetValueOrDefault();
            u.Reason = requisitionDetailOne.Reason;
            u.OutstandingStatus = requisitionDetailOne.OutstandingStatus;
            u.ApprovalStatus = requisitionDetailOne.ApprovalStatus;

            return u;
        }

        public static List<RequisitionDetailOneW> convertList(List<RequisitionDetailOne> list)
        {
            List<RequisitionDetailOneW> listW = new List<RequisitionDetailOneW>();

            foreach (RequisitionDetailOne x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}